﻿#region Using directives
using System;
using System.Web.UI;
using ProcolDemo.Validation;

#endregion

namespace ProcolDemo {
    public partial class _Default : Page {
        protected void Page_Load(object sender, EventArgs e) {
            Common.FillI18NStrings(this, Session);
        }

        protected void ClickHandler(object sender, EventArgs e) {
            String user = UserName.Text;
            String pass = password.Text;

            var uV = new ValidationService();
            uV.ValidateUserPasswordComboCompleted += uV_validateUserPasswordComboCompleted;
            uV.ValidateUserPasswordComboAsync(user, pass);
        }

        protected void uV_validateUserPasswordComboCompleted(object sender,
                                                             ValidateUserPasswordComboCompletedEventArgs e) {
            if (e.Result >= 0) {
                Session["UID"] = e.Result;
                Response.Redirect("Start.aspx", false);
            } else {
                AUTO_LOGIN_INVALID.Visible = true;

                AUTO_LOGIN_LOGIN.Enabled = true;
            }
        }
    }
}